Skip to content

Docker metadata treated as string

  • store information away from the container runtime
  • can be referenced by docker during the rt
  • keyvalue
  • useful for add description or notes
  • store host port or other configuration options --> as labels --> label ark = "heee"
  • key unique in the container context a-z-0-9-. lowercase
  • use an unique namespace com.skill.blabla.someLabel
  • com.dcoker or io.docker are namespace reserved --> namespace specific for the application

structure data as label in Docker

  • docker file is a file with instruction of how to build an image from the scratch
  • new command for tune the image key value data as string opposite to json

FROM ubuntu MANTAINER example LABEL Vendor=SkillSoft LABEL Version=1.0 LABEL com.example.image="{\description\:\"A basic intro"} LABEL Year=2015 LABEL Color=blue //we can define string or integer vaie RUN apt-get update label created internally as json script -too many label is inefficient maintence of the container

docker build - < Dockerfile I can inspect the labels with docker inspect --> into the json there is the label structure

query labels

docker images --> list of images builded --> i can search an image with a specific label docker images --filter "label=Color=blue"